﻿using System;
using HttpApiGateway;
using RpcHelper.Validate;
using Wedonek.RpcStore.Gateway.Interface;
using Wedonek.RpcStore.Gateway.Model;
using Wedonek.RpcStore.Service.Model;

namespace Wedonek.RpcStore.Gateway.Controller
{
        /// <summary>
        /// 链路日志
        /// </summary>
        internal class TraceLogController : ApiController
        {
                private readonly ITraceLogService _Service;
                public TraceLogController (ITraceLogService service)
                {
                        this._Service = service;
                }
                /// <summary>
                /// 链路日志详细
                /// </summary>
                /// <param name="id"></param>
                /// <returns></returns>
                public TraceLogDetailed Get ([NullValidate ("rpc.trace.log.id.null")] Guid id)
                {
                        return this._Service.Get (id);
                }
                /// <summary>
                /// 获取链路日志列表
                /// </summary>
                /// <param name="traceId"></param>
                /// <returns></returns>
                public TraceLog[] Gets ([NullValidate ("rpc.trace.id.null")]
                [LenValidate ("rpc.trace.id.len",32)] string traceId)
                {
                        return this._Service.Gets (traceId);
                }
        }
}
